package adapter;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import bean.PrePareOrReViewDetailBean;
import student.andlei.com.student.R;

public class PrePareTaskWorkAdapter extends BaseQuickAdapter<PrePareOrReViewDetailBean.taskData,BaseViewHolder>{

    private Context context;
    public PrePareTaskWorkAdapter(Context context, int layoutResId, @Nullable List data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, PrePareOrReViewDetailBean.taskData item) {

          helper.setText(R.id.tv_subject,""+item.paper_name);
          helper.setText(R.id.tv_teacher,""+item.real_name);
          helper.setText(R.id.tv_starttime,item.start_time);
          helper.setText(R.id.tv_endtime,item.end_time);
          helper.setText(R.id.tv_workpoint,item.score);
          helper.addOnClickListener(R.id.bt_answer);
            // 批改状态 0未提交 10待批改 100已批改
          if(item.status==0){
            helper.setText(R.id.tv_state,"未提交");
          }else if(item.status==10){
              helper.setText(R.id.tv_state,"待批改");
          }else if(item.status==100){
              helper.setText(R.id.tv_state,"已批改");
          }
          //作业类型 1预习作业 2随堂作业 3课后作业 4试卷
          switch (item.task_type){
              case 1:
                  helper.setText(R.id.tv_tasktype,"预习作业");
                  break;
              case 2:
                  helper.setText(R.id.tv_tasktype,"随堂作业");
                  break;
              case 3:
                  helper.setText(R.id.tv_tasktype,"课后作业");
                  break;
              case 4:
                  helper.setText(R.id.tv_tasktype,"试卷");
                  break;
          }
//        helper.setText(R.id.tv_note_title, StringUtils.isNull(item.title)?"-":item.title);
//        helper.setText(R.id.tv_note_content, StringUtils.isNull(item.content)?"-":item.content);
//        helper.setText(R.id.tv_note_time, StringUtils.isNull(item.time)?"-":item.time);
    }


}
